<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const protecteds = new WeakMap();
      class Common {
        constructor() {
          protecteds.set(this, {
            host: 'https://houdunren.com',
            prot: '80',
          });
        }
        set host(url) {
          if (!/^https:\/\//.test(url)) {
            throw new Error('网址错误');
          }
          protecteds.set(this, { ...protecteds.get(this), host: url });
        }
      }

      class Article extends Common {
        constructor() {
          super();
        }
        lists() {
          return `${protecteds.get(this).host}/article`;
        }
      }
      let article = new Article();
      let lisi = new Article();
      console.log(lisi.lists());
      console.log(article.lists());
    </script>
  </body>
</html>
